package com.itheima.d2_threadmethod;

/**
 * sleep(long time):线程休眠方法  毫秒   1秒=1000毫秒
 */
public class ThreadMethodDemo2 {
    public static void main(String[] args) throws InterruptedException {
        MyThread2 t = new MyThread2();
        t.setName("线程1");
        t.start();
        MyThread2 t2 = new MyThread2();
        Thread.sleep(1000);
        t2.setName("线程2");
        t2.start();
    }
}class MyThread2 extends Thread{

    public void run() {
        Thread thread = Thread.currentThread();
        System.out.println(thread.getName()+"正在执行");
    }
}
